home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / util / misc / Fudgit233.lha / Source / src / readline / keymaps.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  1.7 KB  |  56 lines

  1. /* keymaps.h -- Manipulation of readline keymaps. */
  2.  
  3. #ifndef _KEYMAPS_H_
  4. #define _KEYMAPS_H_
  5.  
  6. #include "chardefs.h"
  7.  
  8. #ifndef __FUNCTION_DEF
  9. typedef int Function ();
  10. typedef void VFunction (char *);
  11. typedef char *CFunction (char *, int);
  12. typedef void CCFunction (char **);
  13. typedef void KFunction (int, int);
  14. #define __FUNCTION_DEF
  15. #endif
  16.  
  17. /* A keymap contains one entry for each key in the ASCII set.
  18.    Each entry consists of a type and a pointer.
  19.    POINTER is the address of a function to run, or the
  20.    address of a keymap to indirect through.
  21.    TYPE says which kind of thing POINTER is. */
  22. typedef struct _keymap_entry {
  23.   char type;
  24.   KFunction *function;
  25. } KEYMAP_ENTRY;
  26.  
  27. /* I wanted to make the above structure contain a union of:
  28.    union { Function *function; struct _keymap_entry *keymap; } value;
  29.    but this made it impossible for me to create a static array.
  30.    Maybe I need C lessons. */
  31.  
  32. typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[128];
  33. typedef KEYMAP_ENTRY *Keymap;
  34.  
  35. /* The values that TYPE can have in a keymap entry. */
  36. #define ISFUNC 0
  37. #define ISKMAP 1
  38. #define ISMACR 2
  39.  
  40. extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
  41. extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
  42.  
  43. /* Return a new, empty keymap.
  44.    Free it with free() when you are done. */
  45. Keymap rl_make_bare_keymap (void);
  46.  
  47. /* Return a new keymap which is a copy of MAP. */
  48. Keymap rl_copy_keymap (Keymap map);
  49.  
  50. /* Return a new keymap with the printing characters bound to rl_insert,
  51.    the lowercase Meta characters bound to run their equivalents, and
  52.    the Meta digits bound to produce numeric arguments. */
  53. Keymap rl_make_keymap (void);
  54.  
  55. #endif /* _KEYMAPS_H_ */
  56.